package acwing;

import java.io.*;

public class ac2816 {
    static final int N = 100010;
    static int[] a = new int[N];
    static int[] b = new int[N];
    public static void main(String[] args) throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String[] s1 = in.readLine().split(" ");
        int n = Integer.parseInt(s1[0]);
        int m = Integer.parseInt(s1[1]);
        String[] s2 = in.readLine().split(" ");
        String[] s3 = in.readLine().split(" ");
        for(int i = 0; i < n; i ++ ) a[i] = Integer.parseInt(s2[i]);
        for(int i = 0; i < m; i ++ ) b[i] = Integer.parseInt(s3[i]);
        int i = 0, j = 0;
        for(j = 0; j < m; j ++ ){
            if(i < n && a[i] == b[j]) {
                i ++ ;
            }
        }
        if(i == n) System.out.println("Yes");
        else System.out.println("No");
    }
}
